/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hero.web.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.opensymphony.xwork2.ActionSupport;

/**
 *
 * @author Volcano
 */
public class BaseAction extends ActionSupport{
	private static final long serialVersionUID = 1L;
	 /**
	 *  获取Spring容器属性
	 */
	private ApplicationContext springContext=WebApplicationContextUtils.getWebApplicationContext(ServletActionContext.getServletContext());
	protected HttpServletRequest request=ServletActionContext.getRequest();
	protected HttpServletResponse response=ServletActionContext.getResponse();
	protected HttpSession session=request.getSession();
	
     protected Object getBean(String beanName)
     {
         return springContext.getBean(beanName);
     }
    /**
     * @return the springContext
     */
    public ApplicationContext getSpringContext() {
        return springContext;
    }

    /**
     * @param springContext the springContext to set
     */
    public void setSpringContext(ApplicationContext springContext) {
        this.springContext = springContext;
    }
    
    
}
